package org.example;

import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.parser.ParserConfig;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description: type校验
 * @Author: sunzhao
 * @Create on: 2022-08-24 19:09
 */
public class XcAutoTypeCheckHandler implements ParserConfig.AutoTypeCheckHandler {
    public Class<?> handler(String typeName, Class<?> expectClass, int features) {
        try {
            System.out.println("========================");
            return this.getClass().getClassLoader().loadClass(typeName);
        } catch (ClassNotFoundException e) {
            throw new JSONException("not support autoType : " + typeName);
        }
    }
}
